class Solution {
public:
    int majorityElement(vector<int>& nums) 
    {
        unordered_map<int,int>count;
        int ret = 0 , cnt = 0;
        for(auto num :nums)
        {
            count[num] ++;
            if(count[num] > cnt)
            {
                ret = num;
                cnt = count[num];
            }
        }
        return ret;
    }
};